<template>
  <div class="app-contain">
    <a-config-provider :locale="zhCN" :autoInsertSpaceInButton="false" :transformCellText="tableCellFormat">
      <template #renderEmpty>
        <a-empty :image="emptyImg"></a-empty>
      </template>

      <router-view />
    </a-config-provider>
  </div>
</template>

<script setup lang="ts">
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import { message } from 'ant-design-vue'
import emptyImg from '@/assets/images/empty.png'
import { createBreakpointListen } from '@/hooks/event/useBreakpoint'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'

dayjs.locale('zh-cn')

message.config({
  top: '140px',
  maxCount: 2
})

// 动态获取屏幕宽度
createBreakpointListen()

const tableCellFormat = ({ text, column, record, index }: any) => {
  if (text) {
    if (Array.isArray(text) && text.length === 0) {
      return '--'
    }
    return text
  } else {
    return '--'
  }
}
</script>

<style lang="less" scoped>
.app-contain {
  height: 100%;
  min-height: 450px;
  min-width: 1200px;
  max-width: 100vw;
}
</style>
